package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.dao.OrderMapper;
import org.example.entity.Order;
import org.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liyishan
 * @date 2024/3/19 16:24
 * @apiNote
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Override
    public void insert(Order order) {
        orderMapper.insert(order);
    }

    @Override
    public Order selectById(Long id) {
        return orderMapper.selectById(id);
    }

    @Override
    public PageInfo<Order> selectPageList() {
        PageHelper.startPage(1,5);
        List<Order> list = orderMapper.selectList(null);
        return new PageInfo<>(list);
    }
}
